const baseUrl = 'http://101.33.239.187:8080/api/1'
// const baseUrl = 'http://192.168.31.36:8080/api/1'
const request = (url = '', date = {}, type = 'GET', header = {}) => {
	try {
		let token =uni.getStorageSync('token')
		header['Token'] = token;
	} catch(e) {
		console.log(e);
	}
	return new Promise((resolve, reject) => {
		uni.request({
			method: type,
			url: baseUrl + url,
			data: date,
			header: header,
			dataType: 'json',
		}).then((response) => {
			setTimeout(function() {
				uni.hideLoading();
			}, 200);
			let res = response;
			resolve(res.data);
		}).catch(error => {
			let err = error;
			reject(err)
		})
	});
}
export default request
